package com.zty.xiaomi.server.Service.Advice;

import com.zty.xiaomi.server.Entity.User;
import com.zty.xiaomi.server.Mapper.Advice;
import com.zty.xiaomi.server.Mapper.RegLogUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdviceServiceImp implements AdviceService {

    @Autowired
    RegLogUser userMapper;
    @Autowired
    Advice adviceMapper;
    @Override
    public boolean save(String username, String text,String title,String email) {
        User user = userMapper.getUserByUserName(username);
        if (adviceMapper.save(text,user.getUserid(),user.getName(),title,email) != 0) {
            return true;
        }else {
            return false;
        }
    }
}
